package com.impzx.restaurant.rest.service;

import java.io.UnsupportedEncodingException;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.fastjson.JSON;
import com.zxpan.restaurant.db.model.Hotel;
import com.zxpan.restaurant.persist.dao.HotelDao;

@Path("/hotel")
public class HotelService {

	@Autowired
	private HotelDao hotelDao;
	
	@Path("/info")
	@GET
	public String getHotelInfo(@QueryParam("hotelId") String hotelId) {
		Hotel hotel = hotelDao.getHotel(hotelId);
		if(hotel != null) {
			String result =  JSON.toJSONString(hotel);
//			try {
				return result;
//						new String(result.getBytes("utf-8"), "utf-8");
//			} catch (UnsupportedEncodingException e) {
//				return "";
//			}
		} else {
			return "";
		}
	}
	
	
}
